﻿using AppService.IService.Financial_Management;
using AppService.IService.System_Carrier_ment;
using AppService.IService.System_operation;
using AppService.Service.Financial_Management;
using AppService.Service.System_Carrier_ment;
using AppService.Service.System_operation;
using Domain.Entity.Basic_information;
using Domain.Entity.Financial_Management;
using Domain.Entity.System_operation;
using Domain.Entity.System_Ordermanagement;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.Financial_Management
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Receivable_meterController : ControllerBase
    {
        private readonly IReceivable_meterService Ireceivable_meterService;

        public Receivable_meterController(IReceivable_meterService ireceivable_meterService)
        {
            Ireceivable_meterService = ireceivable_meterService;
        }

        [HttpGet]
        public int Count(string? Sign_time, string? value2, string? Receipt_type, string? Ord_state)
        {
            return Ireceivable_meterService.Count(Sign_time, value2, Receipt_type, Ord_state);
        }

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Receivable_meter> GetReceivable_meter(int currentPage, int PageSize)
        {
            List<Receivable_meter> zhi = Ireceivable_meterService.GetReceivable_meter(currentPage, PageSize);
            return zhi;
        }

        [HttpGet("{id}")]
        public Orders GetOrd_id(int id)
        {
            return Ireceivable_meterService.GetOrd_id(id);
        }

        [HttpGet("{id}")]
        public Signature_receipt GetSign_id(int id)
        {
            return Ireceivable_meterService.GetSign_id(id);
        }

        [HttpGet("{id}")]
        public Customer_ment GetCustomer_id(int id)
        {
            return Ireceivable_meterService.GetCustomer_id(id);
        }

        /// <summary>
        /// 根据id查询
        /// </summary>
        /// <param name="Receivable_Id"></param>
        /// <returns></returns>
        [HttpGet("{Receivable_Id}")]
        public List<Receivable_meter> GetReceivable_meter_Update(int Receivable_Id)
        {
            return Ireceivable_meterService.GetReceivable_meter_Update(Receivable_Id);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="receivable_meter"></param>
        /// <returns></returns>
        [HttpPut]
        public bool Update([FromBody] Receivable_meter receivable_meter)
        {
            return Ireceivable_meterService.Update(receivable_meter);
        }
    }
}
